import React from 'react';

class Translate {
	constructor(data) {
    	this.data = data;
  	}

  	getList(key) {
  		if (this.data[key]) {
  			return Object.keys(this.data[key]).map(x => {
  				return {label: this.data[key][x], value: x};
  			});
  		} else {
  			return [];
  		}
  	}

    getLabel(key, value) {
      if (this.data[key] && this.data[key][value]) {
        return this.data[key][value];
      } else {
        return value;
      }
    }
}

export default Translate;